package structure.adapter;

import structure.adapter.impl.Adapter;
import structure.adapter.impl.Source;
import structure.adapter.impl.SourceSub1;
import structure.adapter.impl.SourceSub2;
import structure.adapter.impl.Wrapper;

public class AdapterTest {

	public static void main(String[] args) {
		// 类的适配器模式
		Targetable target = new Adapter();
		target.method1();
		target.method2();
		
		// 对象的适配器模式
		Source source = new Source();
		Targetable target2 = new Wrapper(source);
		target2.method1();
		target2.method2();
		
		// 接口的适配器模式
		Sourceable source1 = new SourceSub1();  
        Sourceable source2 = new SourceSub2();  
        source1.method1();  
        source1.method2();  
        source2.method1();  
        source2.method2();  
	}

}
